package com.unism.common.threadPool;


public class Test {

	private static int n = 1;

	public static void main(String args[])throws Exception {
		Test t = new Test();
		t.testt();
	}

	/**
	 * 测试增加线程线程  
	 * @throws Exception 
	 *
	 */
	private void testt() throws Exception {
		TreadPoolFactory.initThreadPool("测试线程组",	2, 1, 60, 60);
		ThreadPool.Pool pool = TreadPoolFactory.getThreadPool() ;
		try {
			Thread.sleep(1000);
			while (n < 10) {
				System.out.println("加入工作任务(" + n + ")");
				pool.putJob(new ThreadPool.Job() {
					public void execute() {
						System.out.println("!!!!!开始工作" + this.hashCode());
						try {
							Thread.sleep(2000);
						} catch (Exception e) {
							;
						}
						System.out.println("!!!!!结束工作" + this.hashCode());
					}
				});
				n++ ;
				Thread.sleep(100);
			}
		} catch (Exception e) {

		}
	}

}
